﻿<cfsilent>
	<cfscript>

		/* 处理当前排课学期数据 */
		event.setArg("pageTitle", "教学运行管理 - 考试安排 - 课程补考计划");
		
		termId = event.getArg("TermID");

		academicYear = event.getArg("AcademicYear");
		academicTerm = event.getArg("AcademicTerm");
		
		currentTab = event.getArg("TabID", "labSummary");
		
		targetArgs = structNew();
		
		/* 读取学期考试安排汇总 */
	
		sql = "SELECT 
					c.institute_id, 
					c.institute_name, 
					count(distinct b.cid) cid_count
				FROM t_resitplan a 
					 INNER JOIN t_course b ON b.cid = a.cid 
					 INNER JOIN t_institute c ON c.institute_id = b.institute_id  
				WHERE 
					a.term_id = :termId 
				GROUP BY 
					c.institute_id, 
					c.institute_name 
				ORDER BY c.institute_name ";
		
		queryObj = new Query(datasource = application.dnsSlave);
		queryObj.addParam( name = "termId", value =termId, cfsqltype="cf_sql_char" );
		
		rs_ins = queryObj.execute(sql = sql).getResult();
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('examResitCourse')#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">生成课程补考计划</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 setting"></i>补考课程设置
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labSummary">class="active"</cfif> id="labSummary" tabTarget="Summary">概况</span>
					</div>
				</div>
				
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
					
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
					
					});
					// -->
					//]]>
				</script>
				
				<div id="Summary" class="tabContent">

					<cfif rs_ins.recordCount>

						<div class="noticeBlock">
							<h3><cfoutput>#academicYear#-#academicTerm#</cfoutput>学期</h3>
							<p><span class="img icon16x16 message"></span>根据课程考核情况, 在<em><cfoutput>#academicYear#-#academicTerm#</cfoutput></em>学期各任课单位所需承担的课程补考安排情况如下.</p>
							<hr/>
						</div>

						<div class="clearfix">
							<div class="UICardTable">
                                <cfloop query="rs_ins"  >
									<cfset structInsert(targetArgs, "DepID", rs_ins.institute_id, true) />
									<dl>
										<dt>
											<a href="<cfoutput>#buildURL('examResitByDepartment', targetArgs)#</cfoutput>">
											<em class="collection"><!--imgholder--></em>
											<dd>
												<h3><cfoutput>#rs_ins.institute_name#</cfoutput></h3>
												<div>安排 <cfoutput>#rs_ins.cid_count#</cfoutput> 门课程补考</div>
											</dd>
											</a>
										</dt>
									</dl>
								</cfloop>
							</div>
						</div>
						
						<cfelse>
						
						<div class="noticeBlock">
							<h3>尚未生成补考任务</h3>
							<p><span class="img icon16x16 message"></span><em><cfoutput>#academicYear#-#academicTerm#</cfoutput></em>学期 期末补考任务尚未生成</p>
							<ol>
								<li class="friendly"><span class="img icon10x10 browser"></span><a href="<cfoutput>#buildURL('examResitCourse')#</cfoutput>">生成学期补考计划</a></li>
							</ol>
						</div>
						
					</cfif>
					
				</div>
				
			</div>
		</li>
	</ul>
</div>